﻿using System;

namespace CosyTrade.Futures
{
    /// <summary>
    /// 订单状态
    /// </summary>
    [Flags]
    public enum OrderFormState
    { 
        /// <summary>
        /// 草稿
        /// </summary>
        Draft=0x00,
        /// <summary>
        /// 待发货订单
        /// </summary>
        WaitDeliverGoods = 0x01,
        /// <summary>
        /// 已发货订单
        /// </summary>
        HasDeliverGoods = 0x02
    }

    /// <summary>
    /// 付款状态
    /// </summary>
    [Flags]
    public enum PayState
    { 
        /// <summary>
        /// 已付清
        /// </summary>
        HasPay = 0x00,
        /// <summary>
        /// 未付清
        /// </summary>
        NoPay = 0x01
    }

    /// <summary>
    /// 付款方式
    /// </summary>
    [Flags]
    public enum PayMethod
    { 
        /// <summary>
        /// 现金
        /// </summary>
        Cash = 0x00,
        /// <summary>
        /// 支票 ()
        /// </summary>
        Cheque = 0x01,
        /// <summary>
        /// 分期付款
        /// </summary>
        Payable = 0x02,
        
    }

    /// <summary>
    /// 出、入口单状态
    /// </summary>
    [Flags]
    public enum ExpImpOrderState
    { 
        /// <summary>
        /// 出口单草稿
        /// </summary>
        ExportDraft = 0x00,
        /// <summary>
        /// 待发货
        /// </summary>
        ExportWaitSend = 0x01,
        /// <summary>
        /// 已发货
        /// </summary>
        ExportWaitFinish = 0x02,
        /// <summary>
        /// 已收货
        /// </summary>
        HasRevice = 0x03,
        /// <summary>
        /// 配送中
        /// </summary>
        Sending = 0x04,
        /// <summary>
        /// 待点货
        /// </summary>
        WaitTallying = 0x05,
        /// <summary>
        /// 完成点货
        /// </summary>
        FinishTallying = 0x06
    }

    /// <summary>
    /// 期货订单状态
    /// </summary>
    [Flags]
    public enum FuturesState
    {
        /// <summary>
        /// 草稿
        /// </summary>
        Draft = 0x00,
        /// <summary>
        /// 正式订单
        /// </summary>
        IsSure = 0x01,
        /// <summary>
        /// 已装箱
        /// </summary>
        InBox = 0x02,
        /// <summary>
        /// 正在海运
        /// </summary>
        BySea = 0x03,
        /// <summary>
        /// 已到港
        /// </summary>
        AtPort = 0x04,
        /// <summary>
        /// 正在发货
        /// </summary>
        DeliverGoods = 0x05,
        /// <summary>
        /// 已收货
        /// </summary>
        TakeGoods = 0x06,
        /// <summary>
        /// 已完成
        /// </summary>
        Finish = 0x07
    }

    public class  EnumHelper
    {
        public static string GetFutureStateCaption(FuturesState state)
        {
            switch (state)
            {
                case FuturesState.Draft:
                    return "新订单";
                case FuturesState.IsSure:
                    return "正式订单";
                case FuturesState.InBox:
                    return "商品已装箱";
                case FuturesState.BySea:
                    return "正在海运";
                case FuturesState.AtPort:
                    return "商品已到港";
                case FuturesState.DeliverGoods:
                    return "正在发货";
                case FuturesState.TakeGoods:
                    return "已收货";
                case FuturesState.Finish:
                    return "订单已完成";
                default:
                    return "新订单";
            }
        }

        public static string GetPayMethodCaption(PayMethod payMethod)
        {
            switch (payMethod)
            {
                case PayMethod.Cash:
                    return "现金";
                case PayMethod.Cheque:
                    return "支票";
                case PayMethod.Payable:
                    return "分期付款";
                default:
                    return "未指定";
            }
        }

        public static string GetPayStateCaption(PayState payState)
        {
            switch (payState)
            {
                case PayState.HasPay:
                    return "已付清";
                case PayState.NoPay:
                    return "未付清";
                default:
                    return "未付清";
            }
        }

        public static string GetOrderFormStateCaption(OrderFormState formState)
        {
            switch (formState)
            {
                case OrderFormState.Draft:
                    return "新订单";
                case OrderFormState.WaitDeliverGoods:
                    return "待发货订单";
                case OrderFormState.HasDeliverGoods:
                    return "已发货订单";
                default:
                    return "新订单";
            }
        }

        public static string GetExpImpOrderStateCaption(ExpImpOrderState orderState)
        {
            switch (orderState)
            {
                case ExpImpOrderState.ExportDraft:
                    return "新出口订单";
                case ExpImpOrderState.ExportWaitSend:
                    return "待发货";
                case ExpImpOrderState.ExportWaitFinish:
                    return "已发货";
                case ExpImpOrderState.HasRevice:
                    return "已收货";
                case ExpImpOrderState.Sending:
                    return "配送中";
                case ExpImpOrderState.WaitTallying:
                    return "待点货";
                case ExpImpOrderState.FinishTallying:
                    return "完成点货";
                default:
                    return "新出口订单";
            }
        }
    }
}